// pages/index/intelligentfilling/intelligentfilling.js
import {
    GetStudentgrades, // 查询我的成绩
    GetStudentgradesProvlist, // 城市列表
    GetStudentgradesFirsttotal, // 弹框数据
    GetStudentGradesList, // 列表数据
    GetStudentgradesTablist, // 汇总列表数据
    GetStudentgradesZyzadd, // 弹窗专业数据
    GetHewillAdd, // 智能填报填报接口
    GetHewilldtlZydel, // 取消填报
    GetHewillMyzylist, // 获取填报了多少个专业数
    GetSendEmailPDF, // 发送PDF到邮箱
} from '../../../api/index'

const app = getApp()
import Toast from '../../../miniprogram_npm/@vant/weapp/toast/toast';

Page({

    /**
     * 页面的初始数据
     */
    data: {
        screenList: [{
                title: "专业条件",
                choose: 1
            },
            {
                title: "院校条件",
                choose: 0
            },
            {
                title: "地域条件",
                choose: 0
            }
        ],
        screenIndex: 0, // 顶部筛选选中下标
        show_wrapper: false,
        fill_show: false,
        showWrapperModel:{},
        wrapperItemList: [{
                rank: "--",
                title: '冲刺',
                backcolor: '#EA5342'
            },
            {
                rank: "--",
                title: '稳妥',
                backcolor: '#2C59EA'
            },
            {
                rank: "--",
                title: '保底',
                backcolor: '#18C397'
            }
        ],
        tabSelectIndex: 0, // 冲刺tab选中下标
        listArray: [], // 列表数据源
        dataSourceArray: [{
                dictType: "ols_question_from",
                dictValue: "A",
                dictLabel: "冲刺--"
            },
            {
                dictType: "ols_question_from",
                dictValue: "B",
                dictLabel: "稳妥--"
            },
            {
                dictType: "ols_question_from",
                dictValue: "C1",
                dictLabel: "保底--"
            }
        ],
        title: '', // 顶部重要提示部分分数

        schoolTypeArray: ["全部", "农林类", "政法类", "语言类", "综合类", "医药类",
            "艺术类", "其他类", "理工类", "师范类", "民族类", "财经类", "体育类", "军事类"
        ],
        schoolfeatureArray: ["不限", "985", "211", "双一流", "国重点", "省重点"],
        schoolnatureArray: ["不限", "公办", "民办", "中外合作办学", "港澳台合作办学"],
        

        // 院校条件筛选
        school_show: false,
        schoolType: '全部', // 院校类型
        schoolFeature: '不限', // 院校特色
        schoolNature: '不限', // 办学性质
        showschoolType: '全部', // 院校类型(展示)
        showschoolFeature: '不限', // 院校特色(展示)
        showschoolNature: '不限', // 办学性质(展示)
        searchSchoolString:'',
        searchProfessionString:'',

        city_show: false, // 
        choose_city_show: false,
        cityList: [],
        rightCityList: [],
        selectCityList: [],
        makeSelectCityList:[],
        classfiySelectIndex: 0,

        chooseFillIndex:0,
        chooseFillModel:'',
        fillProfessionList:'', // 可填报专业数据源

        pageNo:1,
        totalPages:0,
        nomore:false,
        pici:'本科批',

        impore_show:false,
        wkorlkArray:[],
        openVip:app.globalData.openVip,

        emaill_show:false,
        emaillString:'',
    },

     /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
        this.setData({
            openVip:app.globalData.openVip
        })
        console.log('openvip=' +  this.data.openVip);
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {

        let openid = wx.getStorageSync('openId') || '';
        this._GetStudentgrades('?openId=' + openid, false)
        this._GetStudentgradesProvlist('?openId=' + openid, false)
        
        this.setData({
            listArray:[],
            pageNo: 1,
            totalPages: 0,
            nomore: false,
          })
        this.loadRequest(false)
        this._GetStudentgradesFirsttotal({openId:openid}, true)
    },

    // 跳转院校详情
    jumpDetailSchool(event) {
        if (event.currentTarget.dataset.schoolid == null) {
            return
        }
        wx.navigateTo({
          url: '/pages/index/schooldetail/schooldetail?id=' + event.currentTarget.dataset.schoolid,
        })
    },


    // 编辑分数后调用
    navpage() {
        let openid = wx.getStorageSync('openId') || '';
        this._GetStudentgrades('?openId=' + openid, false)
        this._GetStudentgradesProvlist('?openId=' + openid, false)
        
        this.setData({
            listArray:[],
            pageNo: 1,
            totalPages: 0,
            nomore: false,
          })
        this.loadRequest(false)
        this._GetStudentgradesFirsttotal({openId:openid}, true)
        this.setData({
            openVip:app.globalData.openVip
        })
    },

    // 编辑分数
    editScoreAction() {
        wx.navigateTo({
          url: '/pages/mine/editgrade/editgrade',
        })
    },

    // 重要提示
    importHintAction() {
        if (this.data.openVip != 1) {
            this.openVipAction();
            return
        }
        this.setData({
            // impore_show:true
            emaill_show:true
        })
    },
  

    // 跳转志愿表
    submitAction() {
        wx.navigateTo({
        //   url: '/pages/index/currentdesire/currentdesire',
          url: '/pages/index/currentdesire/currentdesire?type=' + this.data.pici
        })
    },


    // 开通vip
    openVipAction() {
        wx.navigateTo({
          url: '/pages/mine/openvip/openvip',
        })
    },

    loadRequest(isLoading) {
        console.log(this.data.lot)
        // let heBatch = this.data.lot == '本+专' ? '' : this.data.lot;
        // let heProv = this.data.province == '全部' ? '' : this.data.province;
        let openid = wx.getStorageSync('openId') || '';
        let schoolType = this.data.schoolType  == '全部' ? '' : this.data.schoolType;
        let is985 = '';
        let is211 = '';
        let isDfc = '';
        let isImpProv = '';
        let isImpCountry = '';
        let isGov = this.data.schoolNature == '不限' ? '' : this.data.schoolNature;
        let bxddb = '';
        if (this.data.schoolFeature == '985') {
            is985 = 1;
        } else if (this.data.schoolFeature == '211') {
            is211 = 1;
            is985 = 0;
        } else if (this.data.schoolFeature == '双一流') {
            isDfc = 1;
        } else if (this.data.schoolFeature == '国重点') {
            isImpProv = 1;
        } else if (this.data.schoolFeature == '省重点') {
            isImpCountry = 1;
        }
        if (this.data.makeSelectCityList.length != 0) {
            bxddb = this.data.makeSelectCityList.join(",");
        }
        let url = '?openId=' + openid + "&is985=" + is985 + '&is211=' + is211 + "&isDfc=" + isDfc + "&isImpProv=" + isImpProv + '&schoolType=' + schoolType + "&isGov=" + isGov + '&bxddb=' +  bxddb + '&zydhmc=' + this.data.searchProfessionString + '&schoolName=' + this.data.searchSchoolString +  "&isImpCountry=" + isImpCountry
        //  + "&pageNum=" + this.data.pageNo + '&pageSize=10'
        this._GetStudentGradesList(url,this.data.tabSelectIndex,isLoading)
        this._GetStudentgradesTablist({openId:openid,is985:is985,is211:is211,isDfc:isDfc,isImpProv:isImpProv,schoolType:schoolType,isGov:isGov,bxddb:bxddb,zydhmc:this.data.searchProfessionString,schoolName:this.data.searchSchoolString,isImpCountry:isImpCountry},false)
    },

    // 填报点击事件
    fillAction(event) {
        console.log(event)
        console.log(this.data.chooseFillModel)
        let item = event.currentTarget.dataset.item
        let index = event.currentTarget.dataset.index
        console.log(item.zyzType)
        
        let openid = wx.getStorageSync('openId') || '';
        let saveZyNum = this.data.listArray[this.data.chooseFillIndex].saveZyNum
        if (item.isTianBao == 1) { // 取消填报
            this.setData({
                ['listArray[' + this.data.chooseFillIndex + '].saveZyNum']: parseInt(saveZyNum) - 1,
                ['chooseFillModel.saveZyNum']: parseInt(saveZyNum) - 1,          
                ['fillProfessionList[' + index + '].isTianBao']: 0,      
            })
            this._GetHewilldtlZydel({
                dtlId: item.dtlId
            }, false)
        } else { // 填报
            this._GetHewillAdd({openId:openid, kldm:this.data.chooseFillModel.kldm,pcdm:this.data.chooseFillModel.pcdm,yxdh:this.data.chooseFillModel.yxdh,zyzdh:this.data.chooseFillModel.zyzdh,zyzType:this.data.chooseFillModel.zyzType,zsjhId:item.zsjhId, zyType:item.zyType}, false, index);
        }
    },

    // 输入框输入事件
    inputEvent(event) {
        console.log(event)
        let id = event.currentTarget.id;
        let value = event.detail.value;
        if (id == "profession") {
            this.setData({
                searchProfessionString:value
            })
        } else if (id == "email") {
            this.setData({
                emaillString:value
            })
        }  else {
            this.setData({
                searchSchoolString:value
            })
        }
    },

    // 键盘搜索
    handleSearch() {
        this.setData({
            listArray:[],
            pageNo: 1,
            totalPages: 0,
            nomore: false,
          })
        this.loadRequest(false)
    },

    // tab切换事件
    onChange(event) {
        console.log(event)
        this.setData({
            tabSelectIndex:event.detail.index
        })
        this.setData({
            listArray:[],
            pageNo: 1,
            totalPages: 0,
            nomore: false,
          })
        this.loadRequest(false)
    },

    // 可填专业点击事件
    effectiveAction(event) {
        console.log(event)
        let item = event.currentTarget.dataset.item
        let index = event.currentTarget.dataset.index
        let openid = wx.getStorageSync('openId') || '';
        this.setData({
            chooseFillIndex:index,
            chooseFillModel:item
        })
        this._GetStudentgradesZyzadd({openId:openid,kldm:item.kldm,pcdm:item.pcdm,yxdh:item.yxdh,zyzdh:item.zyzdh})
    },

    onClickHide() {
        this.setData({
            show_wrapper: false
        })
    },

    // 关闭专业选择
    onCloseFillAction() {
        this.setData({
            fill_show: false,
            
        })
    },

    // 筛选条件点击事件
    screenCellAction: function (event) {
        console.log(event)
        let itemindex = event.currentTarget.dataset.index;
        this.setData({
            screenIndex: itemindex
        })
        for (let index = 0; index < this.data.screenList.length; index++) {
            if (index == itemindex) {
                this.setData({
                    ['screenList[' + itemindex + '].choose']: 1,
                })
            } else {
                this.setData({
                    ['screenList[' + index + '].choose']: 0,
                })
            }
        }
    },

    // 学校类型筛选点击事件
    conditionsSchoolAction() {
        this.setData({
            school_show: true,
            showschoolType: this.data.schoolType, // 院校类型(展示)
            showschoolFeature: this.data.schoolFeature, // 院校特色(展示)
            showschoolNature: this.data.schoolNature, // 办学性质(展示)
        })
    },

    // 弹窗选项点击事件
    showSelectAction: function (event) {
        console.log(event)
        this.setData({
            showschoolType: event.currentTarget.dataset.item
        })
    },

    showFeatureSelectAction: function (event) {
        console.log(event)
        this.setData({
            showschoolFeature: event.currentTarget.dataset.item
        })
    },
    showNatureSelectAction: function (event) {
        this.setData({
            showschoolNature: event.currentTarget.dataset.item
        })
    },
    // 确定
    makeAction() {
        let that = this
        this.setData({
            schoolType: that.data.showschoolType,
            schoolFeature: that.data.showschoolFeature,
            schoolNature: that.data.showschoolNature
        })
        this.onClose();
        this.setData({
            listArray:[],
            pageNo: 1,
            totalPages: 0,
            nomore: false,
          })
        this.loadRequest(false)
    },

    // 弹窗关闭
    onClose() {
        this.setData({
            school_show: false,
            impore_show:false,
            city_show: false,
            choose_city_show: false,
            emaill_show:false,
        })
    },

    // 发送PDF到邮箱
    makeShowAction() {
        

        this.setData({
            emaill_show:false
        })
        var reg = new RegExp('^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$');       
        var emailVar = reg.test(this.data.emaillString);     // 得到的值为布尔型
        if (emailVar == true) {
            // Toast('邮箱正确');
            let openid = wx.getStorageSync('openId') || '';
        let schoolType = this.data.schoolType  == '全部' ? '' : this.data.schoolType;
        let is985 = '';
        let is211 = '';
        let isDfc = '';
        let isImpProv = '';
        let isImpCountry = '';
        let isGov = this.data.schoolNature == '不限' ? '' : this.data.schoolNature;
        let bxddb = '';
        if (this.data.schoolFeature == '985') {
            is985 = 1;
        } else if (this.data.schoolFeature == '211') {
            is211 = 1;
            is985 = 0;
        } else if (this.data.schoolFeature == '双一流') {
            isDfc = 1;
        } else if (this.data.schoolFeature == '国重点') {
            isImpProv = 1;
        } else if (this.data.schoolFeature == '省重点') {
            isImpCountry = 1;
        }
        if (this.data.makeSelectCityList.length != 0) {
            bxddb = this.data.makeSelectCityList.join(",");
        }
        // this._GetSendEmailPDF({toEmail:this.data.emaillString,dataType:'1'},true);
            this._GetSendEmailPDF({openId:openid,is985:is985,is211:is211,isDfc:isDfc,isImpProv:isImpProv,schoolType:schoolType,isGov:isGov,bxddb:bxddb,zydhmc:this.data.searchProfessionString,schoolName:this.data.searchSchoolString,isImpCountry:isImpCountry,toEmail:this.data.emaillString,dataType:'1'},true);
        } else {
            Toast('请填写正确邮箱');
            return
        }
    },

    // 城市筛选点击事件
    conditionsCityAction() {
        console.log(this.data.makeSelectCityList)
        console.log(this.data.makeSelectCityList.length)
        let cityList = this.data.cityList.slice()
        let rightCityList = this.data.rightCityList.slice()
        let that = this;
        if (this.data.makeSelectCityList.length == 0) {
            console.log('走了么')
            cityList.forEach(item =>{
                item.cityList.forEach(model =>{
                    model.choose = 0;
                })    
            })
            rightCityList.forEach(item=>{
                item.choose = 0;
            })
            this.setData({
                selectCityList:[],
                cityList:cityList,
                rightCityList:rightCityList,
                city_show: true,
            })
        } else {
            console.log(that.data.makeSelectCityList);
            console.log(cityList);
            cityList.forEach(item =>{
                item.cityList.forEach(model =>{
                    // console.log(that.data.makeSelectCityList)
                    // console.log(model.cityName)
                    if (that.data.selectCityList.indexOf(model.cityName) > -1) {
                        // console.log('1')
                        model.choose = 1;
                    } else {
                        // console.log('0')
                        model.choose = 0;
                    }
                })    
            })
            console.log(this.data.makeSelectCityList)
            rightCityList.forEach(item=>{
                // console.log(that.data.makeSelectCityList)
                // console.log(item.cityName)
                if (that.data.selectCityList.indexOf(item.cityName) > -1) {
                    // console.log('111')
                    item.choose = 1;
                } else {
                    // console.log('000')
                    item.choose = 0;
                }
            })
            console.log(this.data.makeSelectCityList)
            this.setData({
                selectCityList:this.data.makeSelectCityList,
                cityList:cityList,
                rightCityList:rightCityList,
                city_show: true
            })
            console.log(this.data.makeSelectCityList)
        }
    },

    // 城市筛选左侧点击事件
    left_list(event) {
        console.log(event)
        this.setData({
            rightCityList: this.data.cityList[event.currentTarget.dataset.index].cityList,
            classfiySelectIndex: event.currentTarget.dataset.index,
        })
        console.log(this.data.rightCityList)
    },

    // 城市选中
    itemShowSelectAction(event) {
        let choose = event.currentTarget.dataset.choose
        if (choose == 1) {
            this.setData({
                ['cityList[' + this.data.classfiySelectIndex + '].cityList[' + event.currentTarget.dataset.index + '].choose']: 0,
                ['rightCityList[' + event.currentTarget.dataset.index + '].choose']: 0,
            })
            let array = this.data.selectCityList.slice();
            let nameToRemove = event.currentTarget.dataset.name;
            // 使用 filter 方法来创建一个新数组，不包含需要删除的元素
            let newArray = array.filter(item => item !== nameToRemove);
            // 更新数据
            this.setData({
                selectCityList: newArray
            });
            console.log(this.data.makeSelectCityList)
            console.log(this.data.selectCityList)
        } else {
            console.log('hello')
            if (this.data.selectCityList.length == 20) {
                Toast('最多选择20个城市')
                return
            }
            this.setData({
                ['cityList[' + this.data.classfiySelectIndex + '].cityList[' + event.currentTarget.dataset.index + '].choose']: 1,
                ['rightCityList[' + event.currentTarget.dataset.index + '].choose']: 1,
            })
            console.log(this.data.makeSelectCityList)
            console.log(this.data.selectCityList)
            let mutableArray = this.data.selectCityList.slice(); // 或者 let mutableArray = [...this.data.selectCityList];
            mutableArray.push(event.currentTarget.dataset.name);
            this.setData({
                selectCityList: mutableArray
            });
            console.log(this.data.makeSelectCityList)
            console.log(this.data.selectCityList)
        }
        console.log(this.data.cityList)
    },

    // 城市删除
    cityClickAction(event) {
        let array = this.data.selectCityList;
        let nameToRemove = event.currentTarget.dataset.name;
        // 使用 filter 方法来创建一个新数组，不包含需要删除的元素
        let newArray = array.filter(item => item !== nameToRemove);
        // 更新数据
        this.setData({
            selectCityList: newArray
        });
        let cityList = this.data.cityList
        let rightCityList = this.data.rightCityList
        cityList.forEach(item =>{
            item.cityList.forEach(model =>{
                if (model.cityName == nameToRemove) {
                    model.choose = 0;
                }
            })    
        })
        rightCityList.forEach(item=>{
            if (item.cityName == nameToRemove) {
                item.choose = 0;
            }
        })
        this.setData({
            cityList:cityList,
            rightCityList:rightCityList
        })
    },

    // 选中几个城市点击事件
    chooseCityAction() {
        this.setData({
            choose_city_show: true
        })
    },
    // 关闭
    onCityShowClose() {
        

        this.setData({
            choose_city_show: false
        })
    },

    cityonClose() {
        console.log(this.data.makeSelectCityList)
        this.setData({
            selectCityList:this.data.makeSelectCityList,
            city_show: false,
            choose_city_show: false
        })
        console.log(this.data.makeSelectCityList)
    },

    // 重置
    cityResetAction() {
        let cityList = this.data.cityList
        let rightCityList = this.data.rightCityList
        cityList.forEach(item =>{
            item.cityList.forEach(model =>{
                model.choose = 0;
            })    
        })
        rightCityList.forEach(item=>{
            item.choose = 0;
        })
        this.setData({
            selectCityList:[],
            cityList:cityList,
            rightCityList:rightCityList
        })
    },

    // 确定
    cityMakeAction() {
        console.log("makeSelectCityList赋值")
        console.log(this.data.makeSelectCityList)
        console.log(this.data.selectCityList)
        this.setData({
            makeSelectCityList:this.data.selectCityList,
            selectCityList:[]
        })
        console.log(this.data.makeSelectCityList)
        this.cityonClose();
        this.setData({
            listArray:[],
            pageNo: 1,
            totalPages: 0,
            nomore: false,
          })
        this.loadRequest(false)
    },

    // 我的成绩查询
    _GetStudentgrades(data, isLoading) {
        GetStudentgrades(data, isLoading).then(res => {
            console.log(res)
            let code = res.code;
            // Toast('成功')
            if (code == 200) {
                let array = res.rows;
                let mutableArray = [];
                if (array.length != 0) {
                    let model = array[0]
                    if (model.isWuli == 1) {
                        mutableArray.push('物理')
                    } else {
                        mutableArray.push('历史')
                    }
                    if (model.isHuaxue == 1) {
                        mutableArray.push('化学')
                    }
                    if (model.isShengwu == 1) {
                        mutableArray.push('生物')
                    }
                    if (model.isZhengzhi == 1) {
                        mutableArray.push('政治')
                    }
                    if (model.isDili == 1) {
                        mutableArray.push('地理')
                    }
                    let str = mutableArray.join('/'); // 使用逗号分隔
                    this.setData({
                        title: model.myScore + '/' + model.myWeici + '·' + str + '·' + model.reserve1, 
                        pici:model.reserve1 
                    })
                    console.log('112233')
                    let openid = wx.getStorageSync('openId') || '';
                    
                    this._GetHewillMyzylist('?openId=' + openid, false)
                }
            } else {
                // Toast(res.msg)
            }
        })
    },

    _GetStudentgradesProvlist(data, isLoading) {
        console.log(data)
        let that = this
        GetStudentgradesProvlist(data, isLoading).then(res => {
            console.log(res)
            let code = res.code;
            // Toast('成功')
            if (code == 200) {
                this.setData({
                    cityList: res.data,
                    rightCityList: res.data[0].cityList
                })
            } else {

                Toast(res.msg)
            }
        })
    },

    
    //  弹框数据源
    _GetStudentgradesFirsttotal(data, isLoading) {
        console.log(data)

        GetStudentgradesFirsttotal(data, isLoading).then(res => {
            console.log('弹框数据源')
            console.log(res)
            let code = res.code;
            if (code == 200) {
                this.setData({
                    show_wrapper:true,
                    showWrapperModel:res.data,
                    ['wrapperItemList[0].rank']: res.data.ccNum,
                    ['wrapperItemList[1].rank']: res.data.wtNum,
                    ['wrapperItemList[2].rank']: res.data.bdNum
                })
            } else {
                Toast(res.msg)
            }
        })
    },


    //  列表
    _GetStudentGradesList(data,type, isLoading) {
        console.log(data)
        let that = this
        if (this.data.totalPages <= this.data.listArray.length && this.data.totalPages != 0) {
            this.setData({
              nomore: true
            })
            return;
          }
        GetStudentGradesList(data,type, isLoading).then(res => {
            console.log('列表')
            console.log(res)
            let code = res.code;
            if (code == 200) {
                let array = res.rows;
                that.setData({
                    listArray: that.data.listArray.concat(array),
                    pageNo: that.data.pageNo + 1,
                    totalPages: res.total,
                  });
     
                  if (that.data.totalPages <= that.data.listArray.length && that.data.totalPages != 0) {
                        that.setData({
                            nomore: true
                        })
                  } 
            } else {
                Toast(res.msg)
            }
        })
    },

    // 汇总列表
    _GetStudentgradesTablist(data, isLoading) {
          GetStudentgradesTablist(data, isLoading).then(res => {
            console.log('列表')
            console.log(res)
            let code = res.code;
            if (code == 200) {
                let array = res.rows;
                this.setData({
                    ['dataSourceArray[0].dictLabel']: '冲刺'+ res.data.ccNum,
                    ['dataSourceArray[1].dictLabel']: '稳妥' + res.data.wtNum,
                    ['dataSourceArray[2].dictLabel']: '保底' + res.data.bdNum,

                })
            } else {
                Toast(res.msg)
            }
        })
    },

    
//  弹框专业数据源
_GetStudentgradesZyzadd(data, isLoading) {
    console.log(data)
    GetStudentgradesZyzadd(data, isLoading).then(res => {
        console.log('弹框专业数据源')
        console.log(res)
        let code = res.code;
        if (code == 200) {
            let array = res.data.zyList
            if (array.length != 0) {
                this.setData({
                    fill_show:true,
                    fillProfessionList:array
                })
            }
        } else {
            Toast(res.msg)
        }
    })
},


//  填报
_GetHewillAdd(data, isLoading, index) {
    console.log(data)
    GetHewillAdd(data, isLoading).then(res => {
        console.log('填报')
        console.log(res)
        let code = res.code;
        if (code == 200) {
            let rtnType = res.data.rtnType;
            if (rtnType != 1) {
                Toast(res.data.rtnMsg)
                return
            }
            let saveZyNum = this.data.listArray[this.data.chooseFillIndex].saveZyNum
            this.setData({
                ['listArray[' + this.data.chooseFillIndex + '].saveZyNum']: parseInt(saveZyNum) + 1,
                ['chooseFillModel.saveZyNum']: parseInt(saveZyNum) + 1,
            })
            this.setData({
                ['fillProfessionList[' + index + '].isTianBao']: 1,
                ['fillProfessionList[' + index + '].dtlId']: res.data,
            })
            let openid = wx.getStorageSync('openId') || '';
            this._GetHewillMyzylist('?openId=' + openid, false)
        } else {
            Toast(res.msg)
        }
    })
},

// 取消填报
_GetHewilldtlZydel(data, isLoading) {
    GetHewilldtlZydel(data, isLoading).then(res => {
        console.log(res)
        let code = res.code;
        // Toast('成功')
        if (code == 200) {
            let openid = wx.getStorageSync('openId') || '';
            this._GetHewillMyzylist('?openId=' + openid, false)
        } else {
            Toast(res.msg)
        }
    })
},


// 获取填报了多少专业数
_GetHewillMyzylist(data, isLoading) {
    GetHewillMyzylist(data, isLoading).then(res => {
        console.log(res)
        let code = res.code;
        if (code == 200) {
            this.setData({
                wkorlkArray:res.rows
            })
        } else {
            // Toast(res.msg)
        }
    })
},
// 发送PDF到邮箱
_GetSendEmailPDF(data, isLoading) {
    GetSendEmailPDF(data, isLoading).then(res => {
        console.log(res)
        let code = res.code;
        if (code == 200) {
            this.setData({
                emaillString:''
            })
            Toast({
                type: 'success',
                message: '发送成功',
              });
        } else {
            Toast(res.msg)
        }
    })
},

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

   

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {
        console.log('下拉刷新')
        // 显示顶部刷新图标
        wx.showNavigationBarLoading();
        this.setData({
            listArray:[],
            pageNo: 1,
            totalPages: 0,
            nomore: false,
          })
          this.loadRequest(false)
        // 隐藏导航栏加载框
        wx.hideNavigationBarLoading();
        // 停止下拉动作
        wx.stopPullDownRefresh();
    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {
        console.log('上拉加载更多')
        this.loadRequest(false)
    },

    onShareTimeline: function (){

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})